<?php
require_once 'Response.php';
require_once 'DB.php';
header('Content-Type:text/json;charset=utf-8');
# 设置允许跨域
header("Access-Control-Allow-Origin: *");

$pdo = DB::getInstance()->connect();

if (empty($_REQUEST['id'])) {
    echo '<script>alert("缺少参数")</script>';
    return;
}
$id = $_REQUEST['id'];
//参考：https://www.cnblogs.com/52fhy/p/5352304.html

//3、删除
$sql = "DELETE FROM `menu` WHERE id=$id;";
//var_dump($sql);
$count = $pdo->exec($sql);
if ($count >= 1) {
//    echo "<script>alert('删除成功！');</script>>";
    Response::json('200','删除成功',$count);
}else{
    Response::json('-1','删除成功',$count);
}
//var_dump($count);


//var_dump($menulist);

?>
